/*
 * Copyright (C), 2014-2015, 杭州小卡科技有限公司
 * Created by ciwei@xiaokakeji.com on 2016/06/05.
 */
package com.micromall.web.controller;

import com.micromall.repository.entity.Properties;
import com.micromall.service.PropertiesService;
import com.micromall.web.resp.ResponseEntity;
import com.micromall.web.security.annotation.Authentication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author ciwei@xiaokakeji.com
 * @date 2016/06/05.
 */
@RestController
@Authentication(force = false)
public class DebugAuthController {

	@Resource
	private PropertiesService propertiesService;

	@RequestMapping(value = "/debug_auth")
	public ResponseEntity<?> debug_auth(boolean debug) {
		Properties properties = propertiesService.getProperties("debug.auth");
		properties.setContent(String.valueOf(debug));
		propertiesService.updates(properties);
		return ResponseEntity.Success();
	}
}
